﻿using Deployment.Data.Deploy.Steps.Tasks;
using Deployment.Data.UI.Controls.Task;
using Deployment.Data.UI.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace Deployment.Data.UI.Dialogs.Task
{
    public class TaskDialog :AbstractDialog
    {
        public static readonly DependencyProperty DeploymentProperty =
            DependencyProperty.Register("CurrentStep",
                typeof(Data.Deploy.Steps.Step),
                typeof(TaskDialog));

        public static readonly DependencyProperty EnvironmentsProperty =
            DependencyProperty.Register("Environments",
                typeof(Data.Environment.EnvironmentsFile),
                typeof(TaskDialog));

        

        public Data.Deploy.Steps.Step CurrentStep
        {
            get { return (Data.Deploy.Steps.Step)GetValue(DeploymentProperty); }
            set
            {
                SetValueDp(DeploymentProperty, value);
                (ContentControl as AddTaskControl).CurrentStep = value;
            }
        }

        public Data.Environment.EnvironmentsFile Environments
        {
            get { return (Data.Environment.EnvironmentsFile)GetValue(EnvironmentsProperty); }
            set
            {
                SetValueDp(EnvironmentsProperty, value);
                (ContentControl as AddTaskControl).Environments = value;
            }
        }

        public TaskDialog(AbstractTask Task=null):
            base("Add New Task") 
        {
            this.ContentControl = new AddTaskControl();
            if (Task != null)
                this.ContentControl.DataContext = Task;
        }

        protected override bool performOkAction()
        {
            return true;
        }

        public Data.Deploy.Steps.Tasks.AbstractTask NewTask
        {
            get { return (ContentControl as AddTaskControl).TaskData; }
        }

    }
}
